<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
		var aa = [
                {name:'AAA',age:111,children:[{name:'aaa1',age:12},{name:'aaa2',age:22}]},
                {name:'BBB',age:141,children:[{name:'bbb1',age:15},{name:'bbb2',age:19}]},
                {name:'CCC',age:131,children:[{name:'ccc1',age:18},{name:'ccc2',age:15,children:[{name:'ccccc2',age:10}]}]}
            ];
            for(var i = 0;i<aa.length;i++){

                print(aa[i]);
            }
             function print(arr){
            for(var item in arr){
                if(typeof(arr[item])=='object'){
					console.log("我有后代");
                    for(var i = 0;i<arr[item].length;i++){
                        print(arr[item][i]);
                    }
                }
                else{
                    console.log('没有后代');
                }
            }
        }
		</script>
	</head>
	<body>
	</body>
</html>
